using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework;

namespace Elementum
{
    public class Image:VisibleObject
    {
        protected Vector2 _position;

        public override Vector2 Position {
            set { this._position = value;
            }
            get { return _position; }
        }

        public Image(Animation ani) {
            CurrentAnimation = ani;
            Alpha = 0;
            Scale = 1;
        }


        public Image() {
            _texture = ResourceManager.LoadTexture("images/mySprite");
            CurrentAnimation = new Animation(_texture, new Point(100, 100));
        }

        public Image(string path,int w,int h)
        {
            _texture = ResourceManager.LoadTexture(path);
            CurrentAnimation = new Animation(_texture, new Point(w, h));
        }

        public Image(string path)
        {
            _texture = ResourceManager.LoadTexture(path);
            CurrentAnimation = new Animation(_texture, new Point(_texture.Width, _texture.Height));
            Alpha = 1;
            Scale = 1;
        }

        public override void OnDraw(SpriteBatch spriteBatch)
        {
            if(CurrentAnimation!=null&&Alpha>0)
                CurrentAnimation.OnDraw(spriteBatch, Position);
        }

        public override void OnDraw(SpriteBatch spriteBatch, Matrix transform)
        {
            base.OnDraw(spriteBatch, transform);
            if (CurrentAnimation != null)
                CurrentAnimation.OnDraw(spriteBatch, Position, transform);
            //throw new Exception();
        }


        public override void Update(int delta)
        {
            base.Update(delta);
        }
    }
}
